#!/bin/bash

powercfg -h off

DISM.exe /Online /Get-ReservedStorageState
DISM.exe /Online /Set-ReservedStorageState /State:Disabled

irm https://gitee.com/hevey88/Microsoft-Activation-Scripts/raw/master/get.ps1 | iex
slmgr /xpr
netsh winhttp import proxy source=ie
netsh winhttp set proxy "10.211.55.2:7890"
$env:HTTP_PROXY="http://10.211.55.2:7890"
$env:HTTPS_PROXY="http://10.211.55.2:7890"
$env:all_proxy="socks5://10.211.55.2:7890"

#scoop
#
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

irm get.scoop.sh | iex
# as Admin
iex "& {$(irm get.scoop.sh)} -RunAsAdmin"

scoop config proxy 127.0.0.1:7890
scoop install git sudo

scoop config SCOOP_REPO https://gitee.com/mirrors/scoop

scoop bucket rm main
scoop bucket add main https://mirrors.shanghaitech.edu.cn/git/scoop/main
scoop bucket add extras https://mirrors.shanghaitech.edu.cn/git/scoop/extras
scoop bucket add java https://mirrors.shanghaitech.edu.cn/git/scoop/java
scoop bucket add games https://mirrors.shanghaitech.edu.cn/git/scoop/games
scoop bucket add versions https://mirrors.shanghaitech.edu.cn/git/scoop/versions
scoop bucket add scoopet https://mirrors.shanghaitech.edu.cn/git/scoop/scoopet
scoop bucket add lemon https://mirrors.shanghaitech.edu.cn/git/scoop/lemon
scoop bucket add nerd-fonts https://mirrors.nju.edu.cn/git/scoop-nerd-fonts

scoop bucket add main https://mirrors.nju.edu.cn/git/scoop-main
scoop bucket add extras https://mirrors.nju.edu.cn/git/scoop-extras

scoop install sudo make luarocks fzf fd ripgrep gcc starship zoxide nodejs lsd vcredist2022 git neovim lazygit busybox bottom gdu neofetch
scoop install eza bat less dark innounp perl python
scoop install winget powertoys curl windows-terminal alacritty
scoop install Meslo-NF-Mono CascadiaCode-NF-Mono Inconsolata-NF-Mono
scoop cache rm *
sudo scoop install -g Cascadia-Code
sudo scoop install -g firefox-esr
# coreutils busybox 二选一
#

#gcc luacheck
#sudo ln -s gcc.exe x86_64-w64-mingw32-gcc.exe
#luacheck config file C:/Users/jakcy/scoop/apps/luarocks/current/
# 	LUA_INCDIR = "C:/Users/jakcy/scoop/apps/lua/current/include",
luarocks config variables.LUA_INCDIR C:\Users\jacky\scoop\apps\lua\current\include

scoop install miniconda-cn
conda init powershell
conda config --set show_channel_urls yes
conda config --set auto_activate_base false
conda config --set custom_channels.conda-forge https://mirrors.bfsu.edu.cn/anaconda/cloud/
python -m pip config set global.index-url https://mirrors.bfsu.edu.cn/pypi/web/simple
npm config set registry https://registry.npmmirror.com

# starship,
mkdir -p (Split-Path $PROFILE)
# New-Item $PROFILE
# notepad $PROFILE
echo 'Invoke-Expression (&starship init powershell)' >>$PROFILE
echo 'Invoke-Expression (& { (zoxide init powershell | Out-String) })'>>$PROFILE
echo 'Set-PSReadLineOption -EditMode Emacs'>>$PROFILE
echo 'del Alias:\ls'>>$PROFILE
echo 'del Alias:\pwd'>>$PROFILE
echo 'del Alias:\mv'>>$PROFILE
echo 'del Alias:\rm'>>$PROFILE

git clone --depth 1 https://github.com/AstroNvim/template $env:LOCALAPPDATA\nvim
git clone --depth 1 https://gitee.com/hevey88/a4_user $env:LOCALAPPDATA\nvim\lua\user
sudo ln -sf $env:LOCALAPPDATA\nvim\lua\user\init.lua $env:LOCALAPPDATA\nvim\init.lua

#WSL2
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

wsl --set-default-version 2
wsl --update
wsl --status
wsl --version
wsl --list --online
wsl --list --verbose
wsl --install -d Debian

wsl --install Debian
sudo sed -ri 's/\/\/.*.debian.org/\/\/mirrors.bfsu.edu.cn/' /etc/apt/sources.list

